<?php
/**
 * 显示历来的详情，当状态为45显示微调框
*
* 10-新建计划
* 15-主管驳回计划，
* 20-提交待主管审核，
* 30-主管审核通过(计划)，
* 40-自评打分送审（待主管审核），
* 35-主管驳回，
* 48-主管审核待提交部门经理，
* 50-部门经理待审核，
* 45-部门经理驳回，
* 55-HR驳回，
* 60-HR待审核，
* 70-HR通过
*/
apf_require_controller("Abstract");
apf_require_class("Bll_Jx_Plan");
apf_require_class("Bll_Hr_Property");
class Plan_ViewController extends AbstractController {

    public function handle_request() {
        $params = $this->request->get_parameters();
        $date = $params['searchDate'];
        //check view user
        $this->user_id = $this->request->get_user_id();
        $this->plan_bll = new Bll_Jx_Plan();
        $this->view_user_info = $this->plan_bll->get_user_info_from_kq($this->user_id);
        $this->my_user_id = 5652;
        //取最新领导,直接从OA接中获取
        $this->super_info = array('name'=>'李不太白');
        //$this->view_user_info = array();
        $this->startMonth = intval(substr($date, 4,2));
        $this->endMonth = intval(substr($date, 6,2));
        $this->searchDate = $date;
        $this->year = date('Y',strtotime(substr($date, 0,6).'01'));

        //员工信息,是否试用期
        $is_trial = 0;
        if($this->view_user_info->indue_date !='0000-00-00 00:00:00' && time() < strtotime($this->view_user_info->indue_date) ){
            $is_trial =1;
        }
        $is_trial =1;
        //$this->user_id=4555;
        //$date = 20130403;

        $this->view_user_info->name='曹宏浪';
        $this->view_user_info->superior_code='SHF2938';
        $this->view_user_info->enter_date='2012-03-13 00:00:00';
        $this->view_user_info->department_id=15;
        $this->view_user_info->city_name = '上海';
        $this->view_user_info->group_name='总部';
        $this->view_user_info->department_name='技术部';
        $this->view_user_info->position_name='技术部111';

        $datalist = $this->plan_bll->get_plan_info($this->user_id,$date);

        tp($datalist);
        //根据当前的状态，分别控制自己打分，主管打分,主管评价
        $performance = empty($datalist['base_data']) ? array() : $datalist['base_data'];


        $this->request->set_attribute('review_type_list', Const_JxStatus::review_type_list());
        $this->request->set_attribute('datalist', $datalist);
        $this->request->set_attribute('is_trial', $is_trial);
        #$this->request->set_attribute('is_self', $my_uid);
        $this->request->set_attribute('year', $this->year);
        $this->request->set_attribute('super_info', $this->super_info);
        $this->request->set_attribute('m_to_m', $this->startMonth.'-'.$this->endMonth);
        $this->request->set_attribute('view_user_info', $this->view_user_info);
        return 'Plan_View';
    }
}